Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: breaking changes are now recognized as meaningful #140

Closed
wants to merge 3 commits into from
Closed

fix: breaking changes are now recognized as meaningful #140

wants to merge 3 commits into from

Conversation

steveluscher
Copy link

Closes #139.

@@ -39,12 +39,11 @@
"*": "prettier --ignore-unknown --write"
},
"dependencies": {
"@pkgjs/parseargs": "^0.11.0",
"conventional-commits-parser": "^5.0.0"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This jalopy does not recognize the feat!: message form of commits.

Copy link

codecov bot commented Dec 3, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (e60143e) 63.55% compared to head (765adff) 67.22%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #140      +/-   ##
==========================================
+ Coverage   63.55%   67.22%   +3.67%     
==========================================
  Files           6        6              
  Lines         107      119      +12     
  Branches       12       14       +2     
==========================================
+ Hits           68       80      +12     
  Misses         39       39              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Owner

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀 A good start, thanks for getting it going! Left a few points of discussion - what do you think?

return "meaningful";
}

if (alwaysIgnoredTypes.has(type)) {
return { type };
}
} catch {
/* empty */
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Refactor] I'm not a big fan of try/catch as a control flow concept. It's not type-safe, is hard to mentally model, and can accidentally wrap around unintentionally throwing code too. Let's restrict what's being wrapped to just the toConventionalChangelogFormat call.

import {
parser,
toConventionalChangelogFormat,
} from "@conventional-commits/parser";
Copy link
Owner

@JoshuaKGoldberg JoshuaKGoldberg Dec 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Refactor] 🤔 @conventional-commits/parser hasn't had a commit or sustained GitHub issue triage in 3 years, and uses throw as a form of control flow. Whereas conventional-commits-parser released 3 months ago. I'm a little averse to going down to an older, less-maintained package if it's avoidable.

What do you think about instead using a small regex to check for a subject, optionally an area/scope, and ! at the beginning? /^\w+(\(\w+\))?!:/ or something like that?

Maybe: also filing an issue on conventional-commits-parser to add support for !?

["docs: bump\n\nBREAKING CHANGE: breaks things", "meaningful"],
["docs: bump\n\nBREAKING-CHANGE: breaks things", "meaningful"],
["style: bump\n\nBREAKING CHANGE: breaks things", "meaningful"],
["style: bump\n\nBREAKING-CHANGE: breaks things", "meaningful"],
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Testing] Thinking about test edge cases...

  • ! in the commit body (so not a breaking/meaningful change)
  • Footer note other than BREAKING CHANGE
  • Multiple footer notes

@@ -40,6 +40,17 @@ describe("getCommitMeaning", () => {
["chore(deps): release", "release"],
["chore(deps): release 1.2.3", "release"],
["chore(deps): release v1.2.3", "release"],
// Breaking changes are meaningful no matter the type of the commit.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Style] Just nitpicking here, I think the comment is explanatory from the test cases.

Suggested change
// Breaking changes are meaningful no matter the type of the commit.

@JoshuaKGoldberg JoshuaKGoldberg added the status: waiting for author Needs an action taken by the original poster label Dec 4, 2023
@steveluscher
Copy link
Author

This is all great feedback! Thanks for taking the time to go over it.

I'm going to step away from this PR though instead of finishing it up.

giphy

@steveluscher steveluscher deleted the gotta-break-a-few-eggs branch December 16, 2023 00:14
@hyoban hyoban mentioned this pull request Feb 15, 2024
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting for author Needs an action taken by the original poster
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🚀 Feature: Return true for BREAKING CHANGE?
2 participants